package models

import "database/sql"

// AccountBalance 钱包表
type AccountBalance struct {
	Id              int   `gorm:"column:id;               type:int(11);primary_key"                   json:"id"`
	UserId          int64 `gorm:"column:user_id;          type:bigint(20)         comment:用户ID"      json:"user_id"`
	WithDrawable    int   `gorm:"column:with_drawable;    type:int(11);default:0; comment:可提现"      json:"with_drawable"`
	PendingTransfer int   `gorm:"column:pending_transfer; type:int(11);default:0; comment:待转入"      json:"pending_transfer"`
	Frozen          int   `gorm:"column:frozen;           type:int(11);default:0; comment:已冻结金额"   json:"frozen"`
	GiftCard        int   `gorm:"column:gift_card;        type:int(11);default:0; comment:礼品卡"       json:"gift_card"`
}

func (m *AccountBalance) TableName() string {
	return "account_balance"
}

// AlipayInfo 支付宝信息表
type AlipayInfo struct {
	Id            int    `gorm:"column:id;type:int(11);primary_key"                         json:"id"`
	UserId        int64  `gorm:"column:user_id;type:bigint(20)         comment:用户id"       json:"user_id"`
	UserName      string `gorm:"column:user_name;type:varchar(20);     comment:用户真实姓名"  json:"user_name"`
	AlipayAccount string `gorm:"column:alipay_account;type:varchar(20);comment:支付宝账号;"   json:"alipay_account"`
}

func (m *AlipayInfo) TableName() string {
	return "alipay_info"
}

// MoneyFlow 用户个人信息流水表
type MoneyFlow struct {
	Id          int          `gorm:"column:id;           type:int(11);primary_key"         json:"id"`
	UserId      int64        `gorm:"column:user_id;      type:bigint(20)"                  json:"user_id"`
	Amount      int          `gorm:"column:amount;       type:int(11);    comment:提现金额" json:"amount"`
	RequestTime sql.NullTime `gorm:"column:request_time; type:timestamp;  comment:提现时间" json:"request_time"`
	ArrivalTime sql.NullTime `gorm:"column:arrival_time; type:timestamp;  comment:到账时间" json:"arrival_time"`
	Status      string       `gorm:"column:status;       type:varchar(20) comment:到账状态" json:"status"`
	UpdateTime  sql.NullTime `gorm:"column:update_time;  type:timestamp"                   json:"update_time"`
}

func (m *MoneyFlow) TableName() string {
	return "money_flow"
}

// Tasks 任务表
type Tasks struct {
	Id                    int          `gorm:"column:id;				type:int(11);primary_key"                   json:"id"`
	PublisherId           int64        `gorm:"column:publisher_id;		type:bigint(20);	comment:发布人ID"         json:"publisher_id"`
	TaskName              string       `gorm:"column:task_name;			type:varchar(30);	comment:任务名称;"        json:"task_name"`
	PaymentFee            int          `gorm:"column:payment_fee;		type:int(11);		comment:支付费用;"        json:"payment_fee"`
	TaskContent           string       `gorm:"column:task_content;		type:varchar(300);	comment:任务内容;"        json:"task_content"`
	TaskType              string       `gorm:"column:task_type;			type:varchar(20);	comment:任务类型;"        json:"task_type"`
	TaskStatus            string       `gorm:"column:task_status;		type:varchar(20);	comment:任务状态;"        json:"task_status"`
	PublishTime           sql.NullTime `gorm:"column:publish_time;		type:timestamp;		comment:发布时间"         json:"publish_time"`
	ReceiverId            int64        `gorm:"column:receiver_id;		type:bigint(20);	comment:接单人id"         json:"receiver_id"`
	ReceiverTime          sql.NullTime `gorm:"column:receiver_time;		type:timestamp;		comment:接单时间"         json:"receiver_time"`
	CompletionImage       string       `gorm:"column:completion_image;   type:varchar(20);   comment:任务完成图片"      json:"completion_image"`
	EndTime               sql.NullTime `gorm:"column:end_time;			type:timestamp;		comment:任务结束时间"      json:"end_time"`
	SystemConfirmTime     sql.NullTime `gorm:"column:system_confirm_time;type:timestamp;	comment:系统确认时间"      json:"system_confirm_time"`
	IsAfterSale           int          `gorm:"column:is_after_sale;		type:tinyint(1);	comment:是否售后"         json:"is_after_sale"`
	Notification          string       `gorm:"column:notification;		type:varchar(200);	comment:任务通知"         json:"notification"`
	OnlineTime            sql.NullTime `gorm:"column:online_time;		type:timestamp;		comment:任务上线时间"      json:"online_time"`
	CompletionTimeMinutes int          `gorm:"column:completion_time_minutes;type:int(11);	comment:任务多少分钟内完成" json:"completion_time_minutes"`
	ReviewTime            int          `gorm:"column:review_time		;type:int(11);		comment:发布者审核任务时间" json:"review_time"`
	UpdateTime            sql.NullTime `gorm:"column:update_time;		type:timestamp;		comment:任务更新时间"      json:"update_time"`
}

func (m *Tasks) TableName() string {
	return "tasks"
}

// Users 用户个人信息表
type Users struct {
	Uid             int64        `gorm:"column:uid;				type:bigint(20);primary_key"                  json:"uid"`
	Nickname        string       `gorm:"column:nickname;		type:varchar(30);     comment:昵称"            json:"nickname"`
	Password        string       `gorm:"column:password;		type:varchar(50);	  comment:密码"            json:"password"`
	Gender          string       `gorm:"column:gender;			type:varchar(5);      comment:性别"             json:"gender"`
	Phone           string       `gorm:"column:phone;			type:varchar(15);     comment:手机号;"          json:"phone"`
	Email           string       `gorm:"column:email;			type:varchar(16);     comment:邮箱"            json:"email"`
	Avatar          string       `gorm:"column:avatar;			type:varchar(20);     comment:头像"            json:"avatar"`
	Campus          string       `gorm:"column:campus;		 	type:varchar(10);     comment:校区"            json:"campus"`
	Bio             string       `gorm:"column:bio;             type:varchar(300);    comment:个人简介"         json:"bio"`
	AccountStatus   string       `gorm:"column:account_status;  type:varchar(20);     comment:账号状态"         json:"account_status"`
	AdminPermission string       `gorm:"column:admin_permission;type:varchar(10);	  comment:管理权限"         json:"admin_permission"`
	RegisterTime    sql.NullTime `gorm:"column:register_time;   type:timestamp;       comment:注册时间"         json:"register_time"`
	LoginTime       sql.NullTime `gorm:"column:login_time;      type:timestamp;       comment:最后一次登录时间"  json:"login_time"`
	UpdateTime      sql.NullTime `gorm:"column:update_time;     type:timestamp;       comment:更新时间"         json:"update_time"`
}

func (m *Users) TableName() string {
	return "users"
}

// WorkOrders 工单表
type WorkOrders struct {
	Id              int          `gorm:"column:id;      			type:int(11);  primary_key"         json:"id"`
	TaskId          int          `gorm:"column:task_id; 			type:int(11)        comment:任务id"  json:"task_id"`
	Title           string       `gorm:"column:title;   			type:varchar(100)   comment:标题"    json:"title"`
	Status          string       `gorm:"column:status;  			type:varchar(20)    comment:状态"    json:"status"`
	Description     string       `gorm:"column:description;			type:varchar(300)   comment:问题描述" json:"description"`
	AfterSaleAnswer string       `gorm:"column:after_sale_answer;   type:varchar(300)   comment:售后解答" json:"after_sale_answer"`
	SubmitTime      sql.NullTime `gorm:"column:submit_time;			type:timestamp;		comment:提交时间" json:"submit_time"`
	CompletionTime  sql.NullTime `gorm:"column:completion_time;		type:timestamp;		comment:完成时间" json:"completion_time"`
	UpdateTime      sql.NullTime `gorm:"column:update_time;			type:timestamp;		comment:更新时间" json:"update_time"`
}

func (m *WorkOrders) TableName() string {
	return "workOrders"
}
